package org.example.petitionplatformsystem.dao;

import org.example.petitionplatformsystem.dao.model.Departments;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface DepartmentsRepository extends JpaRepository<Departments, Long> {
    @Query("SELECT d FROM Departments d WHERE d.departmentId = :departmentId AND d.institutionId = :institutionId")
    Optional<Departments> findByIdAndInstitutionId(@Param("departmentId") Long departmentId, @Param("institutionId") Long institutionId);
}
